<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=0, width=device-width" />
    <meta name="format-detection" content="telephone=no" />
    <title>工单列表</title>
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css">
    <link rel="stylesheet" type="text/css" href="../../script/ccssoft/css/ccssoft-lite.css" />
</head>

<body>
    <header class="aui-bar aui-bar-nav ccssoft-aui-bar-theme" id="header">
        <a class="aui-pull-left" tapmode onclick="api.closeWin()"> <span class="aui-iconfont aui-icon-left"></span></a>
        <div class="aui-title" style="">
            我的工单
        </div>
        <a id="menuBtn" class="aui-pull-right" style="display:none;" tapmode onclick="openMenu()"> <span class="aui-iconfont aui-icon-add"></span> </a>
        <a id="goAll" class="aui-btn ccssoft-aui-bar-theme aui-pull-right" tapmode=""  onclick="goAll()"><span class="aui-iconfont aui-icon-home"></span> </a>

        <a id="search" class="aui-pull-right" tapmode onclick="showPopup()"> <span class="aui-iconfont aui-icon-search"></span> </a>
    </header>
    <div id="isshow" class="aui-tab">
        <ul id="tabBox" class="aui-tab-nav">
            <li tabName='waitTaskList1' class="active" tapmode>
                待接单
            </li>
            <li tabName="waitTaskList2" tapmode>
                处理中
            </li>
            <li tabName="waitTaskList3" tapmode>
                待回单
            </li>
        </ul>
    </div>
</body>
<script type="text/javascript" src="../../script/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/debug.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/config.js"></script>
<script type="text/javascript">
    // 打开查询工单页面
    var type = "";
    var index;
    var time = 0;
    var isshow = true;

    // 打开站址查询页面
    function showPopup() {
      $api.setStorage('stateselcetframeName222',$('#tabBox li.active').attr('tabName'));
        var query_setting = {
          stationNameOpt : true,
          stationCodeOpt : true,
            winName: api.winName,
            frameName: $('#tabBox li.active').attr('tabName'),
            callback: 'cb_queryStationList2'
        };
        api.openFrame({
            name : 'popup_query_frm',
            url : '../dialog/popup_station_query1.html',
            rect : {
                x : 0,
                y : 0,
                w : 'auto',
                h : 'auto'
            },
            bounces : false,
            pageParam : query_setting
        });
    }
    // 打开菜单
    function openMenu() {
        api.openFrame({
            name : 'allWorkMenu',
            url : 'allWorkMenu.html',
            bounces : false,
            rect : {
                x : 0,
                y : 0,
                w : 'auto',
                h : 'auto'
            },
            pageParam : api.pageParam,
            reload : true
        });
    }
    apiready = function() {
        var position=api.pageParam.type;
        $api.setStorage('offline', 'false');
        initHeader();
        api.openFrameGroup({
            name: 'all_bill_list_frm',
            rect: frameRect(),
            index:position,
            preload: 0,
            frames: [{
                name: 'waitTaskList1',
                url: 'all_bill_list_frm.html',
                pageParam: {
                  state:1,
                  stationcode : api.pageParam.stationcode,
                  stationname: api.pageParam.stationname,
                  feature: api.pageParam.feature
                },
                bounces: false
            }, {
                name: 'waitTaskList2',
                url: 'all_bill_list_frm.html',
                pageParam: {
                  state:2,
                  stationcode : api.pageParam.stationcode,
                  stationname:api.pageParam.stationname,
                  feature: api.pageParam.feature
                },
                bounces: false
            }, {
                name: 'waitTaskList3',
                url: 'all_bill_list_frm.html',
                pageParam: {
                  state:3,
                  stationcode : api.pageParam.stationcode,
                  stationname:api.pageParam.stationname,
                  feature: api.pageParam.feature
                },
                bounces: false
            }]
        }, function(ret, err) {
            if (ret) {
                    $('#tabBox li:eq(' + ret.index + ')').addClass('active').siblings().removeClass('active');
                    var index = ret.index;
                    if (index == 1) {
                      var stationList2=$api.getStorage('stationList2')

                      // alert(JSON.stringify(stationList2))

                        $api.setStorage('stationList', stationList2);
                        $api.setStorage('stationListType', 2);
                      if(api.pageParam.stationcode){
                        $('#menuBtn').hide(0);
                      }else {
                        $('#menuBtn').show(0);
                      }
                    }else if (index == 0) {
                      $('#menuBtn').hide(0);
                      var stationList1=$api.getStorage('stationList1')
                      // alert(JSON.stringify(stationList1))
                        $api.setStorage('stationList', stationList1);
                        $api.setStorage('stationListType', 1);
                    }else {
                      $('#menuBtn').hide(0);
                      var stationList3=$api.getStorage('stationList3')
                      // alert(JSON.stringify(stationList3))

                        $api.setStorage('stationList', stationList3);
                        $api.setStorage('stationListType', 3);
                    }

            }
        });

        /*jquery事件:tab切换*/
        $('#tabBox li').click(function() {
            $(this).addClass('active').siblings().removeClass('active');
            api.setFrameGroupIndex({
                name: 'all_bill_list_frm',
                index: $(this).index(),
                scroll: true
            });
        });
    };

    function goAll(){
      api.execScript({
          name:'home_win',
          frameName: 'footer_tab_1',
          script: 'goAllaction();'
      });
    }
</script>

</html>
